#include <iostream>
#include <cstring>

#define NAMESIZE	32

using namespace std;

class A {
    protected:
        int m_a;
};

class B : virtual public A { // 虚继承保证基类的成员属性，只继承一份
    protected:
        int m_b;
};

class C : virtual public A {
    protected:
        int m_c;
};

class D : public B, public C {
    protected:
        int m_d;

    public:
        void test() {m_a = 1, m_b = 2, m_c = 3, m_d = 4;}
        void show() {cout << m_a << " " << m_b << " " << m_c << " " << m_d << " " << endl;}
};

int main(void)
{
    D d;
    d.test();
    d.show();

    return 0;
}
